/////////////////////////////////////////////////////////////
//                      C++ Serialization                  //
//                                                         //
//  copyright:   (c) 2011 CPPS                             //
//  authors:     Hikki-Kun                                 //
//  mail:        glrenderable@gmail.com                    //
//                                                         //
//  This program is made available under the terms of      //
//  the MIT License.                                       //
/////////////////////////////////////////////////////////////
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF  //
//  ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED//
//  TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A    //
//  PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT    //
//  SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR   //
//  ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN   //
//  ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,   //
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE   //
//  OR OTHER DEALINGS IN THE SOFTWARE.                     //
/////////////////////////////////////////////////////////////
#ifndef ELLSER_STATIC_ASSERT_HPP
#define ELLSER_STATIC_ASSERT_HPP

//
//  `Private' namespace hides `CompileTimeError' structure
//
namespace Private
{
//
//  if only single template parameter of `CompileTimeError'
//  equals the true the `CompileTimeError' structure is 
//  undefined, so we can use this hehavior for static assert 
//  by declaring a unused object of type `CompileTimeError'
//
  template<bool> 
  struct CompileTimeError;

  template<> 
  struct CompileTimeError<false> {};
}

//
//  This macros declare a object which throw compile time 
//  error if the `check' expression equal true as well as
//  log the `erro_type' & `error_details' to error list
//
#define STATIC_CHECK(check, erro_type, error_details)     \
    {  Private::CompileTimeError<(check)>                 \
       COMPILE_TIME_ERROR_____##                          \
       erro_type##___details_is___##error_details;        \
       (void)COMPILE_TIME_ERROR_____##                    \
       erro_type##___details_is___##error_details; } 

#endif // end file guardian